package com.kun.base

import android.app.Application
import android.os.Debug
import androidx.lifecycle.ViewModelStore
import androidx.lifecycle.ViewModelStoreOwner
import com.alibaba.android.arouter.launcher.ARouter
import com.kun.base.util.ContextUtils
import com.kun.base.util.MMKVUtils

/**
 * baseApplication
 *
 *  @author : Kun
 *  @date : 2021/4/13
 *  @time : 17:20
 */
open class BaseApplication : Application(), ViewModelStoreOwner {

    private val mAppViewModelStore = ViewModelStore();

    override fun onCreate() {
        super.onCreate()
        ContextUtils.init(this)
        MMKVUtils.initMMKV(this)
        if (BuildConfig.DEBUG) {
            ARouter.openDebug()
            ARouter.openLog()
        }
        ARouter.init(this)
    }

    override fun getViewModelStore(): ViewModelStore {
        return mAppViewModelStore
    }
}